<template>
  <div>
    <ul>
      <li v-for="item in arr" :key="item.id">
        {{ item.name }}
        <button @click="del(item.id)">删除</button>
      </li>
      <button @click="run">走一走</button>
    </ul>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr: [
        { id: 1, name: '帅哥' },
        { id: 2, name: '美女' },
        { id: 3, name: '程序猿' }
      ]
    }
  },
  methods: {
    del (id) {
      this.arr = this.arr.filter(item => item.id !== id)
    },
    run () {
      this.arr.push(this.arr[0])
      this.arr.shift()
    }
  }
}
</script>

<style></style>
